<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>培训讲师</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro-blue/easyui.css">
</head>
<body>
<style type="text/css">
	*{
		margin:0px;
		padding:0px;
	}
	.background{
		width: 1116px;
	    height: 570px;
	    margin: 0px auto;
	    margin-top: 12px;
	    background-color: #FFF;
	}
	.table,.table_1{
		width: 1040px;
		margin:0px auto;
		margin-top:20px;
		border: 1px solid #E5E5E5;		
	}
	.datagrid-header .datagrid-cell span{
		color: #19AA9A;
	    font-size: 14px;
	    font-weight: 700;
	}
	.datagrid-header .datagrid-cell,.datagrid-cell, .datagrid-cell-group, .datagrid-header-rownumber, .datagrid-cell-rownumber {
		text-align: center;
	}
	.biao_button{
		background:#d9534f;
		border-radius:3px;
		color:white;
		margin:0 4px;
		width:60px;
		height:25px;
		border:none;
		outline: none;
		cursor:pointer;
	}
	.biao_button:hover{	
		background-color:#C9302C;
	}
	.biao_button_1{
		background-color:#17AA8D;
		border-radius:3px;
		color:white;
		margin:0 4px;
		width:60px;
		height:25px;
		border:none;
		outline: none;
		cursor:pointer;
	}	
	.biao_button_1:hover{
		background-color:#13826B;
	}
	.table .datagrid .panel-body{
	 	width: 1017px;
	}
	.datagrid-header{
		height:39px;
	}
	.datagrid-header-row, .datagrid-row {
   	 	height: 40px;
	}
	.xzsq{
		width: 100px;
	    height: 30px;
	    border: 1px solid #fff;
	    background-color: #17AA8D;
	    color: #fff;
	    margin-left: 3px;
	    text-align: center;
	    line-height: 30px;
	    font-size: 14px;
	}
	#textpxmc,#textpxmc1{
		margin-left: 1px;
    	margin-right: -5px;
	}
	.divs{
		width: 490px;
	    height: 44px;
	    margin-top: 23px;
	}
	#staff_id,#reason,#staff_id1{
		width:230px;
		height:20px;
		border:1px solid #EEEEEE;
		margin-left: 3px;
    	margin-right: -3px;
	}
</style>
<script type="text/javascript">
	$(function(){
		$(".train-course").datagrid({
		    url:'findtea',
		    singleSelect:true,
		    columns:[[
				{field:'teaxuhao',title:'序号',width:120},
				{field:'Staff_name',title:'姓名',width:230},
				{field:'depart_name',title:'部门',width:230},
				{field:'position_name',title:'职位',width:230},
				{field:'caozuo',title:'操作',width:230}					
			]]
		});
		$(".train-course-1").datagrid({
		    url:'findapp',
		    singleSelect:true,
		    columns:[[{field:'apply_id',hidden:true},
				{field:'appxuhao',title:'序号',width:60},
				{field:'Staff_name',title:'申请人',width:130},
				{field:'staff_id',title:'工号',width:130},
				{field:'depart_name',title:'部门',width:130},
				{field:'apply_time',title:'申请时间',width:200},
				{field:'apply_reason',title:'申请原因',width:200},
				{field:'apply_type',title:'申请类型',width:150},
				{field:'pxapproval_state',title:'审核状态',width:150},
				{field:'caozuo',title:'操作',width:200,
					formatter:function formattime(value,row,index){
						if(row['pxapproval_state']=="未审核"){
							return "<input class='biao_button' type='button' onClick='delectapp("+row.apply_id+")' value='撤回'/>";
						}else if(row['pxapproval_state']=="驳回"){
							return "<input class='biao_button_1' type='button' onclick='bohui("+row.apply_id+")' value='查看'/>"
							+"<input class='biao_button' type='button' onClick='delectteas("+row.apply_id+")' value='删除'/>";
						}else if(row['pxapproval_state']=="状态错误"){
							return "<input class='biao_button' type='button' onClick='delectteas("+row.apply_id+")' value='删除'/>";
						}else{
							
						}
					}}
				]]
		});
		$(".xzsq").click(function(){
			$("#zhezhaoceng").show();
		});
		//关闭弹窗
		$(".guanbiya").click(function(){
			$("#zhezhaoceng").hide();
		});
		//关闭弹窗
		$(".guanbiya1").click(function(){
			$("#zhezhaoceng1").hide();
		});
		//取消
		$("#act-off").click(function(){
			$("#zhezhaoceng").hide();
		});
		$("#act-off1").click(function(){
			$("#zhezhaoceng1").hide();
		});
		//确定
		$("#act-on").click(function(){
			var aa=$("#staff_id").combogrid('grid');
			var c=aa.datagrid('getSelected');	
			var reason=$("#reason").val();
			var applytype="申请讲师";
			$.ajax({
				url:"addapplys",
				type:"post",
				data:{"staff_id":c.staff_id,"applyreason":reason,"applytype":applytype},
				success:function(data){
					$("#zhezhaoceng").hide();
					$("#content-admin").panel('open').panel('refresh','train-teacher');
				}
			});
		});		
	});	
	function delectapp(apply_id){
		$.ajax({
			url:"delectapply",
			type:"post",
			data:{"apply_id":apply_id},
			success:function(data){
				$("#content-admin").panel('open').panel('refresh','train-teacher');
			}
		});
	}
	function delectteas(apply_id){
		$.ajax({
			url:"delectteas",
			type:"post",
			data:{"apply_id":apply_id},
			success:function(data){
				$("#content-admin").panel('open').panel('refresh','train-teacher');
			}
		});
	}
	function bohui(apply_id){
		$.ajax({
			url:"applyxq",
			type:"post",
			data:{"apply_id":apply_id},
			success:function(data){
				$("#zhezhaoceng1").show();
			}
		});
	}
	/* function sqlg(staff_id){
		var applyreason="讲师离岗";
		var applytype="申请离岗";
		$.ajax({
			url:"addapplys",
			type:"post",
			data:{"staff_id":staff_id,"applyreason":applyreason,"applytype":applytype},
			success:function(data){
				$("#content-admin").panel('open').panel('refresh','train-teacher');
			}
		})
	} */
	//删除
	/* function delecttea(teach_id){
		$.ajax({
			url:"delecttea",
			type:"post",
			data:{"teacher_id":teach_id},
			success:function(data){
				$("#content-admin").panel('open').panel('refresh','train-teacher');
			}
		})
	} */
</script>
	<div class="background">
		<div id="tt" class="easyui-tabs" style="width:1110px;height:500px;">
		    <div title="讲师管理" style="padding:20px;display:none;">
				<div class="table">
					<table class="easyui-datagrid train-course" style="width:1040px;height:400px"></table>
				</div>
		    </div>
		    <div title="讲师申请" id="titles" data-options="closable:true" style="overflow:auto;padding:20px;display:none;">
				<div class="xzsq">新增申请</div>
				<div class="table_1">					
					<table class="easyui-datagrid train-course-1" style="width:1040px;height:400px"></table>
				</div>
		    </div>
		</div>
	</div>
	<div id="zhezhaoceng" style="width:1366px;height:736px;position:fixed; top:0px;
	background: rgba(0, 0, 0, 0.5);text-align:center;left:0;z-index:10;display:none;" >
		<div style="margin:20px auto;width:480px;height:228px;border-radius: 4px;background:white;border-radius:3px;margin-top: 120px;">
			<div style="width:100%;height:45px;">
				<span style="width:84px;height:30px;line-height:45px;display:inline-block;float:left;margin-left:20px;font-size: 14px;font-weight: 700;color: #999;font-style: normal;" class="xinzeng_text">新增讲师申请</span>
				<button class="icon-close guanbiya" style="float:right;width:45px;height:30px;cursor:pointer;border:none;outline:none;"></button>
			</div>
			<div style="width:100%;height:145px;border-top:solid 1px #E5E5E5;border-bottom:solid 1px #E5E5E5;">
				<input type="hidden" id="cours_id"/>
				<div class="divs">
					<span id="textpxmc"><span style="color:red">*</span>培训讲师：</span>
					<select id="staff_id" class="easyui-combogrid" name="salaryaccount" style="width:230px;"
					    data-options="
					    panelWidth:300,
					    idField:'staff_id',
					    textField:'Staff_name',
					    url:'select_sousuoKuang',
					    columns:[[{field:'sortable',title:'#',width:30},
					        	{field:'staff_id',title:'工号',width:50},
					            {field:'Staff_name',title:'姓名',width:60},
					            {field:'depart_name',title:'部门',width:60},
					            {field:'Staff_phone',title:'联系电话',width:100}
					    ]]">
					    </select>
				</div>
				<div class="divs">
					<span id="textpxmc"><span style="color:red">*</span>申请原因：</span><input type="text" id="reason"/>
				</div>
			</div>
			<div style="width:100%;height:30px;">
				<div style="width:140px;float:right;margin-top:5px;">
					<a id="act-off" href="#" class="easyui-linkbutton" data-options="width:60,height:25">关闭</a>
					<a id="act-on" href="#" class="easyui-linkbutton" data-options="width:60,height:25">确定</a>
				</div>
			</div>
		</div>
	</div>
</body>
</html>